package com.zhangpingyang.mybatisgenerator.controller;

import com.zhangpingyang.mybatisgenerator.common.api.CommonResult;
import com.zhangpingyang.mybatisgenerator.service.UmsMemberService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Zhang Pingyang
 * @Date: 2019/11/8 15:47
 */
@RestController
@Api(tags = "UmsMemberController", description = "验证码")
public class UmsMemberController {
    @Autowired
    private UmsMemberService umsMemberService;

    @GetMapping(value = "getAuthCode")
    @ApiOperation("获取验证码")
    public CommonResult getAuthCode(@RequestParam("telephone") String telephone) {
        return umsMemberService.generateAuthCode(telephone);
    }

    @PostMapping(value = "verifyAuthCode")
    public CommonResult verifyAuthCode(String telephone, String authCode) {
        return umsMemberService.verifyAuthCode(telephone, authCode);
    }
}
